import 'package:json_annotation/json_annotation.dart';

part 'sale_data.g.dart';

@JsonSerializable()
class SaleData extends Object {
  @JsonKey(name: 'last_time')
  String lastTime;

  @JsonKey(name: 'region_shop')
  RegionShop regionShop;

  @JsonKey(name: 'year_target')
  YearTarget yearTarget;

  @JsonKey(name: 'YTD_product_chart_line')
  List<YtdProductChartLline> yTDProductChartLine;

  @JsonKey(name: 'YTD_product_sale_chart')
  List<YtdProductSaleChart> yTDProductSaleChart;

  @JsonKey(name: 'product_category_ranking')
  List<ProductCategoryRanking> productCategoryRanking;

  @JsonKey(name: 'product_category_ranking_max')
  String productCategoryRankingMax;

  @JsonKey(name: 'city_ranking')
  List<CityRanking> cityRanking;

  @JsonKey(name: 'city_ranking_max')
  String cityRankingMax;

  @JsonKey(name: 'product_details')
  List<ProductDetails> productDetails;

  SaleData(
    this.lastTime,
    this.regionShop,
    this.yearTarget,
    this.yTDProductChartLine,
    this.yTDProductSaleChart,
    this.productCategoryRanking,
    this.productCategoryRankingMax,
    this.cityRanking,
    this.cityRankingMax,
    this.productDetails,
  );

  factory SaleData.fromJson(Map<String, dynamic> srcJson) =>
      _$SaleDataFromJson(srcJson);

  Map<String, dynamic> toJson() => _$SaleDataToJson(this);
}

@JsonSerializable()
class RegionShop extends Object {
  @JsonKey(name: 'zone_east')
  ZoneData zoneEast;

  @JsonKey(name: 'zone_south')
  ZoneData zoneSouth;

  @JsonKey(name: 'zone_west')
  ZoneData zoneWest;

  @JsonKey(name: 'zone_north')
  ZoneData zoneNorth;

  RegionShop(
    this.zoneEast,
    this.zoneSouth,
    this.zoneWest,
    this.zoneNorth,
  );

  factory RegionShop.fromJson(Map<String, dynamic> srcJson) =>
      _$RegionShopFromJson(srcJson);

  Map<String, dynamic> toJson() => _$RegionShopToJson(this);
}

@JsonSerializable()
class ZoneData extends Object {
  @JsonKey(name: 'DL_shop_number')
  String dLShopNumber;

  @JsonKey(name: 'prestige_shop_number')
  String prestigeShopNumber;

  @JsonKey(name: 'gold_shop_number')
  String goldShopNumber;

  @JsonKey(name: 'immu_shop_number')
  String immuShopNumber;

  @JsonKey(name: 'P3M_DL_shop_number')
  String p3MDLShopNumber;

  @JsonKey(name: 'P3M_prestige_shop_number')
  String p3MPrestigeShopNumber;

  @JsonKey(name: 'P3M_gold_shop_number')
  String p3MGoldShopNumber;

  @JsonKey(name: 'supreme_shop_number')
  String supremeShopNumber;

  @JsonKey(name: 'P3M_supreme_shop_number')
  String p3MSupremeShopNumber;

  ZoneData(
      this.dLShopNumber,
      this.prestigeShopNumber,
      this.goldShopNumber,
      this.immuShopNumber,
      this.p3MDLShopNumber,
      this.p3MPrestigeShopNumber,
      this.p3MGoldShopNumber,
      this.supremeShopNumber,
      this.p3MSupremeShopNumber);

  factory ZoneData.fromJson(Map<String, dynamic> srcJson) =>
      _$ZoneDataFromJson(srcJson);

  Map<String, dynamic> toJson() => _$ZoneDataToJson(this);
}

@JsonSerializable()
class YearTarget extends Object {
  @JsonKey(name: 'year_target_rate')
  String yearTargetRate;

  @JsonKey(name: 'quarter_order_price')
  String quarterOrderPrice;

  YearTarget(
    this.yearTargetRate,
    this.quarterOrderPrice,
  );

  factory YearTarget.fromJson(Map<String, dynamic> srcJson) =>
      _$YearTargetFromJson(srcJson);

  Map<String, dynamic> toJson() => _$YearTargetToJson(this);
}

@JsonSerializable()
class YtdProductChartLline extends Object {
  @JsonKey(name: 'id')
  String id;

  @JsonKey(name: 'line_name')
  String lineName;

  @JsonKey(name: 'line_name_en')
  String lineNameEn;

  YtdProductChartLline(this.id, this.lineName, this.lineNameEn);

  factory YtdProductChartLline.fromJson(Map<String, dynamic> srcJson) =>
      _$YtdProductChartLlineFromJson(srcJson);

  Map<String, dynamic> toJson() => _$YtdProductChartLlineToJson(this);
}

@JsonSerializable()
class YtdProductSaleChart extends Object {
  @JsonKey(name: 'line_3')
  String line3;

  @JsonKey(name: 'line_9')
  String line9;

  @JsonKey(name: 'months')
  String months;

  YtdProductSaleChart(
    this.line3,
    this.line9,
    this.months,
  );

  factory YtdProductSaleChart.fromJson(Map<String, dynamic> srcJson) =>
      _$YtdProductSaleChartFromJson(srcJson);

  Map<String, dynamic> toJson() => _$YtdProductSaleChartToJson(this);
}

@JsonSerializable()
class ProductCategoryRanking extends Object {
  @JsonKey(name: 'goods_line_name')
  String goodsLineName;

  @JsonKey(name: 'goods_number')
  String goodsNumber;

  @JsonKey(name: 'goods_line_name_en')
  String goodsLineNameEn;

  ProductCategoryRanking(
      this.goodsLineName, this.goodsNumber, this.goodsLineNameEn);

  factory ProductCategoryRanking.fromJson(Map<String, dynamic> srcJson) =>
      _$ProductCategoryRankingFromJson(srcJson);

  Map<String, dynamic> toJson() => _$ProductCategoryRankingToJson(this);
}

@JsonSerializable()
class CityRanking extends Object {
  @JsonKey(name: 'nums')
  String nums;

  @JsonKey(name: 'cname')
  String cname;

  CityRanking(
    this.nums,
    this.cname,
  );

  factory CityRanking.fromJson(Map<String, dynamic> srcJson) =>
      _$CityRankingFromJson(srcJson);

  Map<String, dynamic> toJson() => _$CityRankingToJson(this);
}

@JsonSerializable()
class ProductDetails extends Object {
  @JsonKey(name: 'amount')
  String amount;

  @JsonKey(name: 'goods_number')
  String goodsNumber;

  @JsonKey(name: 'goods_line_id')
  String goodsLineId;

  @JsonKey(name: 'rate')
  String rate;

  @JsonKey(name: 'quarter_rate')
  String quarterRate;

  @JsonKey(name: 'goods_line_name')
  String goodsLineName;

  @JsonKey(name: 'goods_line_name_en')
  String goodsLineNameEn;

  ProductDetails(this.amount, this.goodsNumber, this.goodsLineId, this.rate,
      this.quarterRate, this.goodsLineName, this.goodsLineNameEn);

  factory ProductDetails.fromJson(Map<String, dynamic> srcJson) =>
      _$ProductDetailsFromJson(srcJson);

  Map<String, dynamic> toJson() => _$ProductDetailsToJson(this);
}
